﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace Readify.Management.Automation.GoGrid
{
    public class GoGridError
    {
        internal static GoGridError CreateFromXmlNode(XmlNode objectElementNode)
        {
            GoGridError output = new GoGridError();
            output.ErrorCode = GoGridHelper.GetAttributeElementValueFromXmlNodeAsString(objectElementNode, "errorcode");
            output.Message = GoGridHelper.GetAttributeElementValueFromXmlNodeAsString(objectElementNode, "message");

            return output;
        }

        public string ErrorCode { get; set; }
        public string Message { get; set; }

        public override string ToString()
        {
            return string.Format("{0} ({1})", this.Message, this.ErrorCode);
        }
    }
}
